<?php 	
$v_url = "/list/recordtype/index.php?modal_dialog_mode=1" . "&hdn_recordtype_id=" . $v_recordtype_id . "&fuseaction=DISPLAY_SINGLE_RECORDTYPE" ;
// Kiem tra xem nguoi dang nhap hien thoi co quyen cap nhat hay khong?
if(!_check_permission_on_function($_SESSION['staff_id'], $_ISA_APP_CODE, _CONST_ONEGATE_RECORDTYPE_UPDATE)){?>
	<script>
		alert("<? echo _CONST_FUNCTION_PERMISSION_ERROR; ?>");
		if (_MODAL_DIALOG_MODE==1){
			window.location = "<? echo $v_url; ?>";
		}else{
			window.history.back();
		}	
	</script><?
}
//Danh sach ID cua ho so
$v_record_id_list = "";
if(isset($_REQUEST['hdn_record_id_list'])){
	$v_record_id_list = $_REQUEST['hdn_record_id_list'];
}
//ID nguoi thu ly chinh
$v_primary_handler_id =0;
if(isset($_REQUEST['hdn_primary_handler_id'])){
	$v_primary_handler_id= intval($_REQUEST['hdn_primary_handler_id']);
}
//Danh sach ID nguoi phoi hop thu ly
$v_handler_list_id = "";
if(isset($_REQUEST['hdn_handler_list_id'])){
	$v_handler_list_id= trim($_REQUEST['hdn_handler_list_id']);
} 
$v_staff_id = $_SESSION['staff_id'];
if(_is_sqlserver()){
	$sql = "Exec ONEGATE_SharingRecordUpdate " ;
	$sql = $sql . "'".$v_record_id_list."'";
	$sql = $sql . ",".$v_primary_handler_id;
	$sql = $sql . ",'".$v_handler_list_id."'";
	$sql = $sql . ",".$v_staff_id;
	//echo $sql; exit;
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$rs = $ado_conn->GetRow($sql); 
	$v_error = _replace_bad_char(trim($rs['RET_ERROR']));

}

if (!is_null($v_error) and $v_error<>""){?>
	<script>
		alert("<?php echo $v_error; ?>");
		if (_MODAL_DIALOG_MODE==1){
			window.location = "<?php echo $v_url; ?>";
		}else{
			window.history.back();
		}	
	</script><?php
	exit;
}
sleep(0);
?>
<form action="index.php" method="post" name="f_back">
	<input type="hidden" name="fuseaction" value="DISPLAY_ALL_SHARING_RECORD">
</form>
<Script language="javascript">
	document.forms(0).submit();	
</Script>
